<template>






    <el-form
            :inline="true"
            :model="form"
            ref="form"
            label-width="100px"
            class="demo-ruleForm"
    >
        <el-form-item v-for="item in formLabel" :key="item.model" :label="item.label">
            <el-input
                    v-model="form[item.model]"
                    :placeholder="'请输入' + item.label"
                    v-if="!item.type"

            ></el-input>
            <el-select
                    v-model="form[item.model]"
                    placeholder="请选择"
                    v-if="item.type === 'select'"
            >
                <!--日期选择器-->
                <el-date-picker
                        v-model="form[item.model]"
                        type="datetime"
                        placeholder="选择日期时间"
                        v-if="item.type === 'datetime'">
                </el-date-picker>
                <el-option
                        v-for="item in item.opts"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                ></el-option>
            </el-select>
            <el-switch
                    v-model="form[item.model]"
                    v-if="item.type === 'switch'"
            ></el-switch>
            <el-date-picker
                    v-model="form[item.model]"
                    type="date"
                    placeholder="选择日期时间"
                    v-if="item.type === 'date'"
            >
            </el-date-picker>
        </el-form-item>
        <el-form-item>
            <slot @click="serachtest"></slot>
        </el-form-item>
    </el-form>
</template>

<script>
    export default {
        name: "CommonForm",
        props: {
            inline: Boolean,
            form: Object,
            formLabel: Array,
        },
        methods:{
            handinput(form){
                this.$emit('serach',form)
            },
            serachtest(){
                console.log("safasfgasgas")
            }
        }
    }
</script>

<style scoped>

</style>